package ua.kpi_java_training.tyshchenko.module2;


/**
 * Class contains information about the hurdle
 *
 * @author Vlad Tyshchenko
 * @version 13 June 2013
 */
public class Hurdle {
    private int[][] coordinates;

    /**
     * The constructor initializes array of hurdles
     *
     * @param coordinates
     */
    public Hurdle(int[][] coordinates) {
        this.coordinates = coordinates;
    }

    /**
     * Method checks creature's location in hurdle place
     *
     * @param position - creature's position
     * @return true if creature is in hurdle
     */
    public boolean checkHurdle(Position position) {
        for (int i = 0; i < coordinates[0].length; i++) {
            if (position.getWidth() == coordinates[0][i] && position.getLength() == coordinates[1][i]) {
                return true;
            }
        }
        return false;
    }
}
